home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 13 - 1997 (partial) / 13.05 May 97 / TidyHeap / CTidyHeapLogFileLogger_AC.cp < prev    next >
Encoding:
Text File  |  1997-04-14  |  1.8 KB  |  66 lines  |  [TEXT/MPS ]

  1. //----------------------------------------------------------------------------------------
  2. // CTidyHeapLogFileLogger_AC.cp
  3. // Copyright © 1984-97 by Apple Computer, Inc. All rights reserved.
  4. //----------------------------------------------------------------------------------------
  5.  
  6.  
  7. #ifndef __CTidyHeap_AC__
  8. #include "CTidyHeap_AC.h"
  9. #endif
  10.  
  11. #if qTidyHeap
  12.  
  13. #ifndef __CTidyHeapLogFileLogger_AC__
  14. #include "CTidyHeapLogFileLogger_AC.h"
  15. #endif
  16.  
  17. // toolbox
  18.  
  19. #ifndef __ERRORS__
  20. #include <Errors.h>
  21. #endif
  22.  
  23. // ANSI
  24.  
  25. #ifndef _STRING
  26. #include <string.h>
  27. #endif
  28.  
  29. //========================================================================================
  30. // class CTidyHeapLogFileLogger_AC
  31. //========================================================================================
  32.  
  33. //----------------------------------------------------------------------------------------
  34. // CTidyHeapLogFileLogger_AC constructor
  35. //----------------------------------------------------------------------------------------
  36.  
  37. CTidyHeapLogFileLogger_AC::CTidyHeapLogFileLogger_AC() 
  38. {
  39.     fFile.AppendExtension(".log");
  40.     fFile.SetTypeAndCreator('TEXT','MPS ');
  41. }
  42.  
  43. //----------------------------------------------------------------------------------------
  44. // CTidyHeapLogFileLogger_AC destructor
  45. //----------------------------------------------------------------------------------------
  46.  
  47. CTidyHeapLogFileLogger_AC::~CTidyHeapLogFileLogger_AC()
  48. {
  49. }
  50.  
  51. //----------------------------------------------------------------------------------------
  52. // CTidyHeapLogFileLogger_AC::Log
  53. //----------------------------------------------------------------------------------------
  54.  
  55. void CTidyHeapLogFileLogger_AC::Log(char* inStr)
  56. {
  57.     if(!fFile.IsOpen())
  58.         fFile.Open(CTidyHeapFile_AC::kWrite);
  59.     
  60.     char lineFeed[2] = { 0xD, '\0' };
  61.     ::strcat(inStr, lineFeed);
  62.     
  63.     fFile.Write( inStr, strlen(inStr));
  64. }
  65.  
  66. #endif